package net.atomarrow.pr.service;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import net.atomarrow.db.parser.Conditions;
import net.atomarrow.pr.domain.TbRoleMenu;
import net.atomarrow.services.Service;

public class RoleMenuService extends Service {

	public Set<String> getRoleMenuSet(int roleId) {
		return getRoleMenuSet(getByRoleId(roleId));
	}

	public List<TbRoleMenu> getByRoleId	(int roleId) {
		Conditions conditions = new Conditions(TbRoleMenu.class);
		conditions.putEW("roleId", roleId);
		return getList(conditions);
	}

    public Set<String> getRoleMenuSet(
            List<TbRoleMenu> roleMenus) {
        Set<String> set = new HashSet<String>();
        for (TbRoleMenu roleFunc : roleMenus) {
            set.add(roleFunc.getMenuUrl());
        }
        return set;
    }

}
